package com.upcode.weighing.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.upcode.weighing.domain.SysDetail;
import com.upcode.weighing.domain.SysRes;
import com.upcode.weighing.domain.SysUser;
import com.upcode.weighing.vo.edit.SysUserEditVo;
import com.upcode.weighing.vo.req.pc.SysUserReqVo;
import com.upcode.weighing.vo.resp.pc.SysUserRespVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 * 用户表 Mapper 接口
 * </p>
 *
 * @author alex
 * @since 2019-04-10
 */
@Mapper
public interface SysUserMapper extends BaseMapper<SysUser> {

    Integer checkLoginId(@Param("loginId") String loginId);

    IPage<SysUserRespVo > selectPageList(@Param("page") Page page, @Param("vo") SysUserReqVo tblVehicle) ;

    SysUserEditVo getById(@Param("id") Long id);

    String findLoginNameById(@Param("id") Long id);

    /**
     * 禁用超过30天未登录的账户
     * @param loginNames
     * @return
     */
    Integer disableLongTimeNotLoginUser(@Param("loginNames") List<String> loginNames);

    /**
     * 根据ID重置密码
     * @param user
     * @return
     */
    Integer resetUserPwd(@Param("user") SysUser user);

    /**
     * 禁用指定天数未修改密码的用户
     * @param loginNames
     * @param days
     * @return
     */
    Integer disableLongTimeNotUpPwdUser(@Param("loginNames") String[] loginNames,@Param("days") int days);

    List<SysUserRespVo> selectPageList(@Param("vo") SysUserReqVo reqVo);

    List<String> listAllUserLoginName();

    List<String> listAllUserIdNum();

    List<SysUser> queryList(@Param("vo") SysUserReqVo reqVo);
    List<SysRes> getResByLoginName(@Param("loginName")String loginName);//根据用户名获取菜单
    List<String> getResByParam(@Param("loginName")String loginName);//根据用户获取权限
    List<String> getAdminPer();//超级管理员获取所有权限
    IPage<SysDetail> selectAccount(@Param("page") Page page, @Param("vo") SysDetail vo);//查询账号管理分页列表
    SysDetail getByUserId(@Param("userId") Long userId);//查询账号详情
    int updateByUserId(SysUser user);//根据id修改账号信息
    //删除账号
    boolean updateStatus(Long[] id);
    boolean deleteProjectUser(Long[] id);

}
